﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace UI
{
    /// <summary>
    /// WindowNewStyle.xaml 的交互逻辑
    /// </summary>
    public partial class WindowNewStyle : Window
    {

        private NewBaseStyle newBaseStyle = new NewBaseStyle();

        public WindowNewStyle()
        {
            InitializeComponent();
            this.WindowState = WindowState.Maximized;
            this.MouseDown += WindowNewStyle_MouseDown;

            this.DataContext = newBaseStyle;

            newBaseStyle.PageChoose("主接线图");

        }

        private void WindowNewStyle_MouseDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }
    }


    public partial class NewBaseStyle : ObservableObject
    {
        [ObservableProperty]
        private string _TitleName;
        [ObservableProperty]
        private string _PageName;

        [ObservableProperty]
        Class.SimulationTestData _QiTestData;


        public NewBaseStyle()
        {
            TitleName = "山西长治经坊煤业 3MW/3MWh";
            QiTestData = new Class.SimulationTestData();


            var basePath = System.IO.Path.GetDirectoryName(typeof(App).Assembly.Location);
            var Json_For_ThemeSetting = "/JsonS/Json_For_ThemeSetting.json";
            QiTheme = new Themes.ThemeChoose($"{basePath}/{Json_For_ThemeSetting}");
        }

        [RelayCommand]
        public void PageChoose(string _pageName)
        {

            PageName = _pageName;
            //MessageBox.Show(_pageName);
            switch (_pageName)
            {
                case "主接线图":
                    {
                        if (PC_UserControl_RealTimeView == null)
                        {
                            PC_UserControl_RealTimeView = new Pages.PC_UserControl_RealTimeView();
                        }
                        WhatPage_ShowOn = PC_UserControl_RealTimeView;
                    }
                    break;
                case "系统信息":
                    {
                        if (PC_UserControl_Infomation == null)
                        {
                            PC_UserControl_Infomation = new Pages.PC_UserControl_Infomation();
                        }
                        WhatPage_ShowOn = PC_UserControl_Infomation;
                    }
                    break;
                case "画面索引":
                    {
                        if (PC_UserControl_Table == null)
                        {
                            PC_UserControl_Table = new Pages.PC_UserControl_Table();
                        }
                        WhatPage_ShowOn = PC_UserControl_Table;
                    }
                    break;
                case "有功控制":
                    {
                        if (PC_UserControl_DataGrid == null)
                        {
                            PC_UserControl_DataGrid = new Pages.PC_UserControl_DataGrid();
                        }
                        WhatPage_ShowOn = PC_UserControl_DataGrid;
                    }
                    break;
                    break;
                default:
                    break;
            }
        }

        #region 页面选择功能
        [ObservableProperty]
        private UserControl _WhatPage_ShowOn = null;

        Pages.PC_UserControl_RealTimeView PC_UserControl_RealTimeView = null;
        Pages.PC_UserControl_Infomation PC_UserControl_Infomation = null;
        Pages.PC_UserControl_Table PC_UserControl_Table = null;
        Pages.PC_UserControl_DataGrid PC_UserControl_DataGrid = null;



        #endregion



        [RelayCommand]
        public void ThemeChoose(string _themeName)
        {
            QiTheme.ChangeTheme(_themeName);
        }
        private Themes.ThemeChoose QiTheme = null;


    }
}
